import { http } from '@/utils/http'

export interface IBannerResult {
  imageUrl: string
  linkUrl: string
  title: string
}

export const getBannerList = () => {
  return http.get<IBannerResult[]>('/jeecg-boot/htmmp/main/getBannerList')
}

export interface IBrandResult {
  brandImage: string
  brandName: string
}

export const getBrandList = () => {
  return http.get<IBrandResult[]>('/jeecg-boot/htmmp/main/getBrandList')
}

export interface IProductResult {
  brand: string
  cartonSpec: string
  coverCustomer: string
  createBy: string
  createTime: string
  id: string
  isDeleted: string
  l1Type: string
  l1TypeCode: string
  l2Type: string
  l2TypeCode: string
  mainPic: string
  otherCode: string
  productName: string
  productSpec: string
  purchasePrice: number
  status: string
  supplyPrice: number
  tenantId: string
  type: string
  upcCode: string
  updateBy: string
  updateTime: string
  weight: number
  quantity: number
}

export const getHotList = () => {
  return http.get<IProductResult[]>('/jeecg-boot/htmmp/main/getHotList')
}

export interface IJscode2sessionResult {
  openid: string
  session_key: string
}

export const jscode2session = (jscode: string) => {
  return http.get<IJscode2sessionResult>(`/jeecg-boot/htmmp/main/jscode2session?js_code=${jscode}`)
}
